<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>事件绑定</title>
	<script type="text/javascript" src="tool.js"></script>
		<script type="text/javascript" src="base07.js"></script>
	</head>

	<body>
		<div>
			测试

		</div>
		
		<input type="button" value="按钮" id="button" />

    <a href="http://www.yc60.com" id="a">瓢城Web俱乐部</a>
	</body>

	<script>
		//测试
		/*	window.onload =function (){
				alert('我123');
			}
			window.onload =function (){
				alert('后面覆盖前面的');
			}*/


		//不会覆盖
	/*	addEvent(window, 'load', function() {
			alert('1');
		});
		addEvent(window, 'load', function() {
			alert(2)
		});
		addEvent(window, 'load', function() {
			alert('3');
		});
		
		* */
		

var oButton = document.getElementById('button');
	/*
	addEvent(oButton, 'click', fn1);
	addEvent(oButton, 'click', fn2);
	addEvent(oButton, 'click', fn3);
	removeEvent(oButton, 'click', fn2);
	*/
	
	var a = document.getElementById('a');
	addEvent(a, 'click', function (e) {
		e.preventDefault();
	});
	
	addEvent(oButton, 'click', function (e) {
		e.stopPropagation();
		alert('button');
	});
	
	addEvent(document, 'click', function () {
		alert('document');
	});
	


function fn1(e) {
	alert('1' + this.value + e.clientX);
}

function fn2(e) {
	alert('2' + this.value + e.clientX);
}

function fn3(e) {
	alert('3' + this.value + e.clientX);
}

	
	</script>

</html>